<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>超级专家分析管理</title>
	<meta name="decorator" content="default"/>
	<style type="text/css">
		#tip-msg{
			width: 80%;
			margin:auto;
		}
		.detailtr{
			overflow:hidden;white-space:nowrap;width:260px;text-overflow:ellipsis;
		}
	</style>
</head>
<body>
	<tags:breadcrumb name="breadcrumb" />
	<div class="icon-buttons">
		<input type="button" class="leave-clean-session" data-inline="true" data-icon="back" data-iconpos="notext" value="返回"/>
	</div>
	<form:form id="searchForm" modelAttribute="expertManualService" action="${ctx}/expert/expertManualService/" method="post" class="breadcrumb form-search">
		<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
		<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
		<div class="middleCls">
			<c:if test="${expertManualAmount > 0}">
				<input type="button" value="添加请求" data-inline="true" onclick="loginPasswordPopup('${ctx}/expert/expertManualService/form')">
			</c:if>
			<label>问题状态：</label>
			<fieldset data-role="controlgroup" data-type="horizontal" data-inline="true">
		        <input type="radio" name="status" id="all" value="0" ${empty status || status == -1 ? "checked" : ""}>
		        <label for="all">全部</label>
		        <input type="radio" name="status" id="notAnswer" value="0" ${status == 0 ? "checked" : ""}>
		        <label for="notAnswer">未答复</label>
		        <input type="radio" name="status" id="reply" value="1" ${status == 1 ? "checked" : ""}>
		        <label for="reply">已答复</label>
			</fieldset><br/>
			<label>开始日期：</label>
			<input type="date" id="startDate" data-inline="true" name="startDate" value="${startDate}"/>
			<label>结束日期：</label>
			<input type="date" id="endDate" data-inline="true" name="endDate" value="${endDate}"/>
			<c:if test="${expertManualAmount < 1}">
				<input type="button" data-inline="true" disabled="disabled" value="添加请求">
			</c:if>
			<input id="btnSubmit" type="submit" value="查询" data-inline="true"/>
		</div>
	</form:form>
	<c:if test="${expertManualAmount > 0}">
		<div class="middleCls"><font color="red">提示:</font>本月的超级专家分析请求剩余${expertManualAmount}次。</div><br/>
	</c:if>
	<c:if test="${expertManualAmount < 1}">
		<div class="middleCls"><font color="red">提示:</font>本月的超级专家分析请求已用完，无法再次添加，如有需要，请下个月申请！</div><br/>
	</c:if>
	<tags:message content="${message}"/>
	<h3 class="middleCls">超级专家分析列表</h3>
	<div class="form-input">
		<table id="contentTable" data-role="table" class="ui-responsive table-stroke">
			<thead><tr><th>请求日期</th><th>请求问题</th><th>状态</th></tr></thead>
			<tbody>
			<c:if test="${empty page.list}">
				<tr>
					<td colspan="3">无记录</td>
				</tr>
			</c:if>
			<c:if test="${not empty page.list}">
				<c:forEach items="${page.list}" var="expertManualService">
					<tr id="${expertManualService.id}">
						<td>
						${fns:formatDate(expertManualService.askDatetime, "yyyy-MM-dd HH:mm:ss")}
						</td>
						<td>
							<p class="detailtr">${expertManualService.question}<p>
						</td>
						<td>${expertManualService.status ==1?"已答复":"未处理"}</td>
					</tr>
				</c:forEach>
			</c:if>
			</tbody>
		</table>
		<div class="pagination">${page}</div>
	</div>
	<script type="text/javascript">
		$(document).ready(function() {
			$("#contentTable tbody tr").click(function(){
				if (!this.id){
					return;
				}
				$("#contentTable tbody tr").removeClass("select_active");
				$(this).addClass("select_active");
				window.location.href="${ctx}/expert/expertManualService/detail?id=" + this.id;
			});
			jQuery("#searchForm").validate({
		 		submitHandler: function(form){
					var startValue = $("#startDate").val();
					if (!startValue){
						showTip("开始日期必须填写!");
						return;
					}
					var endValue = $("#endDate").val();
					if (!endValue){
						showTip("结束日期必须填写!");
						return;
					}
					if(startValue && endValue){
						 var start = new Date(startValue.replace(/-/g, "/"));
						 var end = new Date(endValue.replace(/-/g, "/"));
						 if (end < start) {
							showTip("结束日期不能大于开始日期!");
							return;
						}
					 }
					 loading("正在提交，请稍等...");
					 form.submit();
				}
	        });
		});
		function page(n,s){
			$("#pageNo").val(n);
			$("#pageSize").val(s);
			$("#searchForm").submit();
        	return false;
        }
	</script>
</body>
</html>
